namespace SimpleWebServices.Web.UI
{
    using System.Xml.Serialization;
    using SimpleWebServices;
    using Xunit;

    public sealed class HtmlContentFacts
    {
        [Fact]
        public void typedef()
        {
            Assert.True(new ObjectExpectations<HtmlContent>()
                .DerivesFrom<object>()
                .IsConcreteClass()
                .IsSealed()
                .HasDefaultConstructor()
                .XmlRoot("content")
                .Result);
        }

        [Fact]
        public void ctor()
        {
            Assert.NotNull(new HtmlContent());
        }

        [Fact]
        public void prop_TypeName()
        {
            Assert.True(new PropertyExpectations(typeof(HtmlContent).GetProperty("TypeName"))
                .XmlAttribute("type")
                .IsAutoProperty<string>()
                .Result);
        }

        [Fact]
        public void prop_Value()
        {
            Assert.True(new PropertyExpectations(typeof(HtmlContent).GetProperty("Value"))
                .XmlText()
                .IsAutoProperty<string>()
                .Result);
        }

        [Fact]
        public void op_ToString()
        {
            string expected = "value";
            
            HtmlContent obj = new HtmlContent
            {
                Value = expected
            };

            string actual = obj.ToString();

            Assert.Equal<string>(expected, actual);
        }
    }
}